package com.mercury.rabbitmq.listener;

import com.mercury.rabbitmq.base.BaseListener;
import com.mercury.rabbitmq.config.delay.DelayedBuilder;
import com.mercury.rabbitmq.domain.RabbitMqMessage;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * 延时队列(延时插件) 监听
 *
 * @author mercury
 */
@Slf4j
@Component
public class ManagerDelayedListener extends BaseListener {


    @Override
    protected void execute(RabbitMqMessage content) {
        log.info("execute delayed success");
    }

    @Override
    protected void failExecute(RabbitMqMessage content) {
        log.info("execute delayed fail");
    }


    @RabbitListener(queues = DelayedBuilder.DEFAULT_DELAYED_QUEEN)
    @Override
    protected void receiveMessage(Message message, Channel channel) throws IOException {
        super.receiveMessage(message, channel);
    }


}
